<ui:composition xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	template="template/template.xhtml">
	<ui:define name="title">
		<h:outputText value="#{msgs.scriptsElicitation}"/>
	</ui:define>
	<ui:define name="bodyInclude">
		<ui:include src="include/menu.xhtml" />
		<p:fieldset legend="#{msgs.eligiblesHierarchies}" toggleable="true">
			<p:outputPanel layout="block" styleClass="container">
				<h:form id="scriptsElicitationForm">
					<p:dataTable currentPageReportTemplate="{currentPage} #{msgs.of} {totalPages}" emptyMessage="#{msgs.emptyDataTableMessage}" id="eligiblesHierarchiesTable" paginator="true" paginatorAlwaysVisible="false" paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport}{PageLinks}{NextPageLink} {LastPageLink}" rows="10" rowsPerPageTemplate="5,10,20,50" value="#{scriptsElicitationController.eligiblesHierarchies}" var="hierarchy">
						<p:column headerText="#{msgs.project}" sortBy="#{hierarchy.project.name}" styleClass="center">
							<h:outputText value="#{hierarchy.project.name}"/>
						</p:column>
						<p:column headerText="#{msgs.version}" sortBy="#{hierarchy.version.name}" styleClass="center">
							<h:outputText value="#{hierarchy.version.name}"/>
						</p:column>
						<p:column headerText="#{msgs.creationDate}" sortBy="#{hierarchy.creationDate}" styleClass="center">
							<h:outputText value="#{hierarchy.creationDate}">
								<f:convertDateTime dateStyle="medium" locale="#{localeController.locale}"/>
							</h:outputText>
						</p:column>
						<p:column headerText="#{msgs.updateValue}" sortBy="#{hierarchy.lastUpdateDate}" styleClass="center">
							<h:outputText value="#{hierarchy.lastUpdateDate}">
								<f:convertDateTime dateStyle="medium" locale="#{localeController.locale}"/>
							</h:outputText>
						</p:column>
						<p:column headerText="#{msgs.actions}" styleClass="center">
							<p:commandButton action="#{scriptsElicitationController.onElicitateHierarchy}" alt="#{msgs.elicitate}" image="ui-icon ui-icon-gear" process="@this" rendered="#{(sessionController.sessionUser.responsable or sessionController.sessionUser.administrator) and not hierarchy.elicited}" update="scriptsElicitationForm:eligiblesHierarchiesTable" title="#{msgs.elicitate}">
								<f:setPropertyActionListener target="#{scriptsElicitationController.currentHierarchy}" value="#{hierarchy}" />
							</p:commandButton>
							<p:commandButton action="#{scriptsVisualisationController.onScriptsVisualisation}" alt="#{msgs.visualize}" image="ui-icon ui-icon-search" process="@this" rendered="#{hierarchy.elicited}" title="#{msgs.visualize}">
								<f:setPropertyActionListener target="#{scriptsVisualisationController.currentHierarchy}" value="#{hierarchy}" />
							</p:commandButton> 
							<p:commandButton action="#{iterationAssignmentController.onStartingIterationAssignment}" alt="#{msgs.assignCriterions}" image="ui-icon ui-icon-transferthick-e-w" process="@this" rendered="#{(sessionController.sessionUser.responsable or sessionController.sessionUser.administrator) and hierarchy.elicited}" title="#{msgs.assignCriterions}">
								<f:setPropertyActionListener target="#{iterationAssignmentController.currentHierarchy}" value="#{hierarchy}" />
							</p:commandButton>
						</p:column>
					</p:dataTable>
				</h:form>
			</p:outputPanel>
		</p:fieldset>
	</ui:define>
</ui:composition>